import React, { Component } from 'react'

// 引入css-in-js样式并设置样式 
import {ContainerNav} from './style'

// 设置默认值
import { string,func,element,oneOfType} from 'prop-types'

class TopNavBar extends Component {
  render() {
    const { children,leftText,rightText,onLeft,onRight } = this.props
    return (
      <ContainerNav>
        <div onClick={onLeft}>{leftText}</div>
        <div>{children}</div>
        <div onClick={onRight}>{rightText}</div>
      </ContainerNav>
    )
  }
}

TopNavBar.prototypes = {
    children: oneOfType([string ,element]),
    leftText:string,
    rightText:string,
    onLeft:func,
    onRight:func
}

// 设置默认值
TopNavBar.default={
    leftText:'',
    onLeft:e => {},
    rightText:'',
    onRight:e => {}
}

export default TopNavBar